package io.renren.modules.generator.controller;

import io.renren.common.utils.R;
import io.renren.modules.generator.dto.GardenPortraitCommonResult;
import io.renren.modules.generator.dto.GardenPortraitWeekWarning;
import io.renren.modules.generator.service.GardenPortraitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author zhangxu
 * @create 2020/9/15
 * Description: 园区画像页面专用controller
 */
@RestController
@RequestMapping("generator/gardenportrait")
@Api("园区画像页面专用接口")
public class GardenPortraitController {

    @Autowired
    private GardenPortraitService gardenPortraitService;

    /**
     * 预警总揽
     */
    @RequestMapping("/warining/general")
    @ApiOperation("预警总揽")
    public R wariningGeneral(){
        Map<String,Object> map = gardenPortraitService.wariningGeneral();
        return R.ok().put("data", map);
    }

    /**
     * 预警事件类型比例
     */
    @RequestMapping("/warining/porportion")
    @ApiOperation("预警事件类型比例")
    public R wariningPorportion(){
        Map<String,Object> map = gardenPortraitService.wariningPorportion();
        return R.ok().put("data", map);
    }

    /**
     * 周预警趋势
     */
    @RequestMapping("/warining/weekstatis")
    @ApiOperation("周预警趋势")
    public R wariningWeekstatis(){
        List<GardenPortraitWeekWarning> gardenPortraitCommonResultList = gardenPortraitService.wariningWeekstatis();
        return R.ok().put("data", gardenPortraitCommonResultList);
    }

    /**
     * 设备运行时长
     */
    @RequestMapping("/device/runtime")
    @ApiOperation("设备运行时长")
    public R deviceRuntime(){
        List<GardenPortraitCommonResult> gardenPortraitCommonResultList = gardenPortraitService.deviceRuntime();
        return R.ok().put("data", gardenPortraitCommonResultList);
    }






}
